package net.homelinux.ajay.net.ondisk.client;

import net.homelinux.ajay.net.ondisk.view.client.AppTreeItem;

import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class PropertyPanel extends com.google.gwt.user.client.ui.DockPanel {
  
  private VerticalPanel menuPanel;
  private FlexTable table;
  private AppTreeItem item;

  PropertyPanel(){
    menuPanel= new VerticalPanel();
    add(menuPanel,NORTH);
    initPropertyTab();
  }
 
  private void initPropertyTab() {
    table = new FlexTable();
    table.setTitle(".ajay.properties.grid");
    table.setStyleName(".ajay.properties.grid");
    table.setBorderWidth(1);
    table.setCellSpacing(0);
    table.setCellPadding(1);
    table.setWidth("100%");
    add(table,CENTER);
    table.getRowFormatter().setStyleName(0, "gridtitle");
    table.insertRow(0);
    table.addCell(0);
    table.addCell(0);
    table.setText(0, 0, "Name");
    table.setText(0, 1, "Value");
    table.insertRow(0);
    table.addCell(1);
    table.addCell(1);
  }

  public void refresh(AppTreeItem item) {
//    if(this.item !=null){
//      this.item.getAppObject().removeChangeListener(this);
//    }
    this.item = item;
    menuPanel.clear();
    menuPanel.add(item.getMenuBar());
//    menuPanel.add(item.getTableDataProvider());
  }

  
}
